/*
	This file is part of PropExtractor.

	PropExtractor is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	PropExtractor is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with PropExtractor. If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef _PEIMAGE_H_
#define _PEIMAGE_H_

#include "PEObject.h"

namespace pe
{

	struct PEImageRaw
	{
		unsigned int width, height;
		byte bpp;
		byte* data;
	};

	PE_EXPORT int PEImageRawCreate(PEImageRaw* a_Target, unsigned int a_Width, unsigned int a_Height);
	PE_EXPORT int PEImageRawSetPixelAtIndex(PEImageRaw* a_Target, unsigned int a_Index, byte a_Red, byte a_Green, byte a_Blue, byte a_Alpha = 255);

	PE_EXPORT int PEImageRawSaveToFile(PEImageRaw* a_Data, const wchar_t* a_FilePath, const char* a_Pattern = "%workingdir%uncompressed_%name%.png");

	PE_EXPORT int PEImageRawDelete(PEImageRaw* a_Data);

	class PE_DLL_EXPORT PEImage : public PEObject
	{
	
	public:
	
		PEImage();
		~PEImage();
	
		virtual int LoadHeader(PEStream* a_Stream);
		virtual int LoadBody();

		PEImageRaw* GetData() { return m_Data; }

	protected:

		unsigned int m_Width, m_Height;
		PEImageRaw* m_Data;
		PEStream* m_Stream;
	
	}; // class PEImage

}; // namespace pe

#endif